<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>无线公共支持综合网</title>
    <link rel="stylesheet" href="__ROOT__/Public/evaluate/css/reset.css" />
    <link rel="stylesheet" href="__ROOT__/Public/evaluate/css/base.css" />
    <link rel="stylesheet" href="__ROOT__/Public/evaluate/css/login.css" />
    <link rel="stylesheet" href="__ROOT__/Public/evaluate/css/index.css" />
    <style>
        body {
            height: auto;
            overflow: hidden;
        }

        .ui_dialog_bg, .log_dialog {
            display: block;
        }

        .ui_dialog_title_close {
            display: none;
        }
    </style>
</head>
<body>
<div class="">

    <div class="header">
        <div class="nav_bg">
            <div class="nav">
                <ul>
                    <li class="nav_sy"><a href="#">首页</a></li>
                    <li class="nav_cpk"><a href="#">产品库</a></li>
                    <li class="nav_pjpc"><a href="#">评级评测</a></li>
                    <li class="nav_wbzy"><a href="#">外包资源</a></li>
                    <li class="nav_xwgs"><a href="#">新闻故事</a></li>
                    <li class="nav_ywxq"><a href="#">业务需求</a></li>
                </ul>
                <div class="search">
                    <form action="javascript:void(0);" class="search_form">
                        <label for="search_input" class="search_label">请输入内容</label>
                        <input id="search_input" class="search_input" type="text" />
                        <button type="submit"></button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <div class="banner">
        <div class="banner_bg">
            <div class="login">
                <ul>
                    <li><a class="reg_btn" href="javascript:void(0);">注册</a>|</li>
                    <li><a class="log_btn" href="javascript:void(0);">登录</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
<include file="Public:dialog" />
<script src="__ROOT__/Public/evaluate/js/jquery-1.11.2.min.js"></script>
<script>
    (function ($) {
        var ui = {
            //dialog
            //通用
            $dialog: $('.ui_dialog'),
            $document_width: $(window).width() / 2,
            $document_height: $(window).height() / 2,
            $dialog_width: function () {
                return this.$dialog.width() / 2;
            },
            $dialog_height: function () {
                return this.$dialog.height() / 2;
            },
            $dialog_close: $('.ui_dialog_title_close,.ui_dialog_title_close_xqtj'),
            $dialog_bg: $('.ui_dialog_bg'),
            $old_account: $('.old_account'),
            //注册
            $reg_btn: $('.reg_btn'),
            $reg: $('.reg_dialog'),
            $reg_form: $('form.reg_form'),
            $username_reg: $('#username_reg'),
            $email_reg: $('#email_reg'),
            $password_reg: $('#password_reg'),
            //登录
            $log_btn: $('.log_btn'),
            $log: $('.log_dialog'),
            $log_form: $('form.log_form'),
            $email_log: $('#email_log'),
            $password_log: $('#password_log'),
            //忘记密码
            $forget_box: $('.forget_dialog'),
            $forget_btn: $('.forget_btn'),
            $back_account: $('.back_account'),
            $back_log:$('.back_log')
        };

        var oPage = {
            //注册事件
            init: function () {
                this.dialog();
                this.close_dialog();
                this.open_dialog_reg();
                this.open_dialog_log();
                this.open_forget_password();
                this.open_account();
                this.reg_form();
                this.log_form();
                this.back_account();
                this.back_log();
            },
            //打开注册dialog
            open_dialog_reg: function () {
                ui.$reg_btn.on('click', function () {
                    ui.$dialog_bg.fadeIn();
                    ui.$reg.fadeIn();
                });
            },
            open_account: function () {
                ui.$old_account.on('click', function () {
                    ui.$reg.fadeOut();
                    ui.$log.fadeIn();
                });
            },
            //打开登录dialog
            open_dialog_log: function () {
                ui.$log_btn.on('click', function () {
                    ui.$dialog_bg.fadeIn();
                    ui.$log.fadeIn();
                });
            },
            back_account: function () {
                ui.$back_account.on('click', function () {
                    ui.$log.fadeOut();
                    ui.$reg.fadeIn();
                });
            },
            //忘记密码dialog
            open_forget_password: function () {
                ui.$forget_btn.on('click', function () {
                    ui.$log.hide();
                    ui.$forget_box.show();
                });
            },
            back_log:function(){
                ui.$back_log.on('click', function () {
                    ui.$forget_box.hide();
                    ui.$log.show();
                });
            },
            //关闭dialog
            close_dialog: function () {
                var close_fun = function () {
                    ui.$dialog_bg.fadeOut();
                    ui.$dialog.fadeOut();
                    ui.$ui_dialog_xqtj.fadeOut();
                    //隐藏错误提示
                    ui.$reg_form.find('input').next().hide();
                    ui.$log_form.find('input').next().hide();
                    ui.$xqtj_form.find('input').next().hide();
                };
                ui.$dialog_close.on('click', function () {
                    close_fun();
                });
                $(window).keydown(function (event) {
                    if (event && event.keyCode == 27) {
                        close_fun();
                    }
                });
            },
            //dialog定位
            dialog: function () {
                $('.ui_dialog').css({
                    'left': ui.$document_width - ui.$dialog_width() + 'px',
                    'top': ui.$document_height - ui.$dialog_height() - 80 + 'px'
                });
            },
            //注册表单验证
            reg_form: function () {
                ui.$reg_form.on('submit', function (e) {
                    if (ui.$username_reg.val() === '') {
                        ui.$username_reg.next().show();
                    }
                    if (ui.$email_reg.val() === '') {
                        ui.$email_reg.next().show();
                    }
                    if (ui.$password_reg.val() === '') {
                        ui.$password_reg.next().show();
                    }
                    e.stopPropagation();
                });
                ui.$username_reg.on('focus', function () {
                    ui.$username_reg.next().hide();
                });
                ui.$email_reg.on('focus', function () {
                    ui.$email_reg.next().hide();
                });
                ui.$password_reg.on('focus', function () {
                    ui.$password_reg.next().hide();
                });
            },
            //登录表单验证
            log_form: function () {
                ui.$log_form.on('submit', function (e) {
                    if (ui.$email_log.val() === '') {
                        ui.$email_log.next().show();
                    }
                    if (ui.$password_log.val() === '') {
                        ui.$password_log.next().show();
                    }
                    e.stopPropagation();
                });
                ui.$email_log.on('focus', function () {
                    ui.$email_log.next().hide();
                });
                ui.$password_log.on('focus', function () {
                    ui.$password_log.next().hide();
                });
            }
        };
        oPage.init();
    })(jQuery);
</script>
</body>
</html>